# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=ubuntu-app-launch-git
_pkgname=ubuntu-app-launch
pkgver=r3022.bde4305
pkgrel=4
pkgdesc='Session init system job for Launching Applications'
url='https://github.com/ubports/ubuntu-app-launch'
arch=(x86_64 i686 armv7h aarch64)
license=(GPL)
conflicts=(ubuntu-app-launch)
provides=(ubuntu-app-launch)
depends=(zeitgeist gobject-introspection lttng-ust mir libertine-git unity-api-git properties-cpp curl)
makedepends=(git cmake  cmake-extras-git dbus-test-runner gmock lcov gcovr)
source=('git+https://github.com/ubports/ubuntu-app-launch.git'
        'FormatTruncation.patch'
        'Gtest.patch')
sha256sums=('SKIP'
            'db5684a2f42a664d1e1c10af2e1ff6f0edb43d63e7936d37ca75c575875f7f97'
            '3c0a88fce3e8af6ac648a026b2fe592b614b511763ad9defeb87659f29b4a1bd')

BUILDENV+=('!check') # Some tests are broken

prepare() {
  cd ${_pkgname}
  git checkout bionic

  patch -Np1 -i "${srcdir}/FormatTruncation.patch"
  patch -Np1 -i "${srcdir}/Gtest.patch"
}

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

build() {
  cd ${_pkgname}
  sed -i 's/-std=gnu99/-std=gnu99 -Wno-deprecated-declarations/g' CMakeLists.txt
  sed -i 's/-std=c++11/-std=c++11 -Wno-deprecated-declarations/g' CMakeLists.txt
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" -DCMAKE_INSTALL_LIBEXECDIR="lib/" .
  make
}

check() {
  cd ${_pkgname}
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}
  make DESTDIR="${pkgdir}/" install
}
# vim:set ts=2 sw=2 et:
